<?php
/**
 * Created by PhpStorm.
 * User: jocky
 * Date: 2017/7/20
 * Time: 下午1:07
 */
?>

<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <form class="form-horizontal form-label-left" id="agent_set_form">
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                    编号
                </label>
                <div class="col-md-7 col-sm-7 col-xs-12">
                    <input type="text" class="form-control" value="<?= $info->clientSN; ?>" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12"> 姓名 </label>
                <div class="col-md-7 col-sm-7 col-xs-12">
                    <input type="text" name='alias' class="form-control"
                           placeholder="为空表示不修改姓名" maxlength="12" value="<?= $info->alias; ?>">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                    重置密码
                </label>
                <div class="col-md-7 col-sm-7 col-xs-12">
                    <input type="password" name="password" class="form-control"
                           placeholder="为空表示不修改密码" maxlength="12">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                    密码确认
                </label>
                <div class="col-md-7 col-sm-7 col-xs-12">
                    <input type="password" name="password_confirm" class="form-control"
                           placeholder="长度为6-12位" maxlength="12">
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                    注册日期
                </label>
                <div class="col-md-7 col-sm-7 col-xs-12">
                    <input type="text" disabled class="form-control"
                           value="<?= date('Y-m-d H:i:s', $info->create_time); ?>">
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                    手机号码
                </label>
                <div class="col-md-7 col-sm-7 col-xs-12">
                    <input type="text" disabled class="form-control"
                           value="<?= $cellphone; ?>">
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                    账户推荐码
                </label>
                <div class="col-md-7 col-sm-7 col-xs-12">
                    <input type="text" disabled class="form-control"
                           value="<?= $info->recommend_code; ?>">
                </div>
            </div>
            <?php if ($is_first || $is_parent) { ?>
                <div class="form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">
                        手续费模板
                    </label>
                    <div class="col-md-7 col-sm-7 col-xs-12">
                        <div class="form-control">
                            <?= $templateInfo ? $templateInfo->title : '未分配'; ?>
                        </div>
                    </div>
                </div>
            <?php } ?>

            <?php if ($is_first) { ?>
                <div class="form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">
                        是否返现
                    </label>
                    <div class="col-md-7 col-sm-7 col-xs-12">
                        <select name="trade_cost_return_flag" class="form-control">
                            <option value="1" <?= $info->trade_cost_return_flag == 1 ? 'selected' : ''; ?>>是</option>
                            <option value="0" <?= $info->trade_cost_return_flag == 0 ? 'selected' : ''; ?>>否</option>
                        </select>
                    </div>
                </div>
            <?php } ?>

            <?php if ($info->login_flag != 0) { //激活后，代理可以设置是否禁用此账户?>
                <div class="form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">
                        账号状态
                    </label>
                    <div class="col-md-7 col-sm-7 col-xs-12">
                        <select name="login_flag" class="form-control">
                            <option value="1" <?= $info->login_flag == 1 ? 'selected' : ''; ?>>正常</option>
                            <option value="2" <?= $info->login_flag == 2 ? 'selected' : ''; ?>>限制</option>
                        </select>
                    </div>
                </div>
            <?php } ?>

            <hr style="border-top-style: dashed;margin-bottom: 30px;"/>
            <ul class="nav nav-tabs bar_tabs" role="tablist">
                <li role="presentation" class="active">
                    <a href="#agent_uid_links" role="tab" data-toggle="tab"
                       aria-expanded="true">代理层级链</a>
                </li>
                <li role="presentation">
                    <a href="#agent_direct_links" role="tab" data-toggle="tab"
                       aria-expanded="false">返佣层级链</a>
                </li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane fade active in padding" id="agent_uid_links" style="padding: 10px;">
                    <table class="table table-bordered table-hover">
                        <tbody>
                        <?php
                        $str = "<tr><th>级别</th><th>编号</th><th>姓名</th><tr>";
                        $len = count($links);
                        for ($i = 0; $i < $len; $i++) {
                            $tmp = $links[$i];
                            $str .= "<tr>";
                            $str .= "<td> " . $tmp['level_name'] . "</td>";
                            $str .= "<td>" . $tmp['clientSN'] . "</td>";
                            $str .= "<td>" . $tmp['alias'] . "</td>";
                            $str .= " </tr > ";
                        }
                        echo $str;
                        ?>
                        </tbody>
                    </table>
                </div>
                <div class="tab-pane fade" id="agent_direct_links" style="padding: 10px;">
                    <table class="table table-bordered table-hover">
                        <tbody>
                        <?php
                        $str = "<tr><th>级别</th><th>编号</th><th>姓名</th><tr>";
                        $len = count($direct_links);
                        for ($i = 0; $i < $len; $i++) {
                            $tmp = $direct_links[$i];
                            $str .= "<tr>";
                            $str .= "<td> " . $tmp['level_name'] . "</td>";
                            $str .= "<td>" . $tmp['clientSN'] . "</td>";
                            $str .= "<td>" . $tmp['alias'] . "</td>";
                            $str .= " </tr > ";
                        }

                        if ($len == 0) {
                            $str .= "<tr>";
                            $str .= "
                                    <td colspan='4' 
                                        class='text-center' 
                                        style='height: 50px;color: red;vertical-align: middle;'>
                                        未绑定返现账号
                                    </td>
                            ";
                            $str .= "</tr>";
                        }
                        echo $str;
                        ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <?php
            echo \yii\helpers\Html::hiddenInput(
                Yii::$app->request->csrfParam,
                Yii::$app->request->getCsrfToken()
            );
            ?>
        </form>
    </div>
</div>
